$(function() {
	if ($('[tag=theme][oid=transverse]').size() == 0) {
		$('.dk_sidebar').css('min-height', $(window).height() + 500);
		$(window).resize(function() {
			$('.dk_sidebar').css('min-height', $(window).height() + 500);
		});
	};	
//左边导航条高度自适应	end
	$('#test').click(function() {
		if($('#def').size() != 0) {
			$("#def").remove();
			$("<link>").attr({ id: 'def2', rel: "stylesheet", type: "text/css", href: "css/dk_framework/dk.layout.sidebar.open.css"}).appendTo("head");
		} else {
			$("#def2").remove();
			$("<link>").attr({ id: 'def', rel: "stylesheet", type: "text/css", href: "css/dk_framework/dk.layout.sidebar.shrinkage.css"}).appendTo("head");
		}
	});
//右边导航展开收缩	end	
	/*$('#dk_sidebar .dk_menu li').bind({
		mouseover : function() {
			$(this).find('.dk_sub_menu').show();
		},
		mouseout : function() {
			$(this).find('.dk_sub_menu').hide();
		}
	});
	$('#dk_sidebar .dk_menu li ul li').bind({
		mouseover : function() {
			$(this).find('.dk_sub2_menu').show();
		},
		mouseout : function() {
			$(this).find('.dk_sub2_menu').hide();
		}
	});*/
	
//导航显示隐藏 end
$(".info").hover(function(){
	$(this).find(".dk_downbox").show();
	$('.dk_user span').text('▲')
},function(){
	$(this).find(".dk_downbox").hide();
	$('.dk_user span').text('▼')
});


/*以下下拉菜单*/
jQuery.divselect = function(divselectid, inputselectid, callback) {
	var inputselect = $(inputselectid);

	// init
	var text, selectid;
	if ($(divselectid + " ul li a[def=true]").size() != 0) {
		text = $(divselectid + " ul li a[def=true]").text();
		selectid = $(divselectid + " ul li a[def=true]").attr('selectid');
		if (callback) {
			callback(text, selectid);
		}
	} else if ($(divselectid + " ul li a").size() != 0) {
		text = $(divselectid + " ul li a").first().text();
		selectid = $(divselectid + " ul li a").first().attr('selectid');
		if (callback) {
			callback(text, selectid);
		}
	} else {
		text = "没有可选项";
		selectid = "";
	}
	$(divselectid + " div div[class=citeT]").text(text);
	inputselect.val(selectid);

	// show
	$(divselectid + " div").unbind('click').click({
		viewid : divselectid,
		inputid : inputselectid
	}, function(e) {
		var ul = $(e.data.viewid + " ul");
		if (ul.css("display") == "none") {
			ul.slideDown("fast");
		} else {
			ul.slideUp("fast");
		}
		e.stopPropagation();
	});

	// click
	$(divselectid + " ul li a").unbind('click').click({
		viewid : divselectid,
		inputid : inputselectid
	}, function(e) {
		var txt = $(this).text();
		$(e.data.viewid + " div div[class=citeT]").html(txt);
		var value = $(this).attr("selectid");
		inputselect.val(value);
		$(e.data.viewid + " ul").hide();

		if (callback) {
			callback(txt, value);
		}
		e.stopPropagation();
	});

	// hide
	$(document).unbind('click').click({
		viewid : divselectid,
		inputid : inputselectid
	}, function(e) {
		$(e.data.viewid + " ul").hide();
		e.stopPropagation();
	});
	
	// hide hover
	$(divselectid).hover(function(){
		//$(this).find("ul").show();
	},function(){
		$(this).find("ul").hide();
	});
};	

})











  
